Skip to content

Instantly share code, notes, and snippets.

View firatkucuk's full-sized avatar
🍉

Fırat Küçük firatkucuk

🍉
View GitHub Profile
@Toanzzz
Toanzzz / delete-slack-messages.js
Last active January 21, 2020 18:53 — forked from firatkucuk/delete-slack-messages.js
Deletes slack public/private channel and chat messages.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Token can get from: https://api.slack.com/custom-integrations/legacy-tokens
// Pass it as a parameter: node ./delete-slack-messages.js TOKEN CHANNEL_ID
// Or use it without download the script: curl -Ls RAW_GIST_URL | node - TOKEN CHANNEL_ID
// GLOBALS #############################################################################################################
const [, , token, channel, _delay = 300] = process.argv
@antonfisher
antonfisher / allow-privileged-for-microk8s.md
Last active September 24, 2021 09:53
MicroK8s add --allow-privileged=true flag

Add --allow-privileged=true to:

# kubelet config
sudo vim /var/snap/microk8s/current/args/kubelet

#kube-apiserver config
sudo vim /var/snap/microk8s/current/args/kube-apiserver

Restart services:

@varnav
varnav / redirect_browser_language.nginx
Last active July 25, 2021 17:25
Nginx can redirect to language subsite based on browser language
map $http_accept_language $index_redirect_uri {
default "/en/";
"~(^|,)en.+,ru" "/en/";
"~(^|,)ru.+,en" "/ru/";
"~(^|,)en" "/en/";
"~(^|,)ru" "/ru/";
}
location = / {
return 302 $index_redirect_uri;
@shodanshok
shodanshok / blocksync.py
Last active April 25, 2023 13:23 — forked from rcoup/blocksync.py
Block device sync between remote hosts. Based off http://www.bouncybouncy.net/programs/blocksync.py
#!/usr/bin/env python
"""
Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff <justin@bouncybouncy.net>
Copyright 2011 Robert Coup <robert@coup.net.nz>
License: GPL
Getting started:
@jonikarppinen
jonikarppinen / CustomErrorController.java
Last active June 16, 2021 02:19
Example of replacing Spring Boot "whitelabel" error page with custom error responses (with JSON response body)
package com.company.project.controllers;
import com.company.project.model.api.ErrorJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
@jeffcogswell
jeffcogswell / q_example.js
Last active August 12, 2022 01:22
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
@rxaviers
rxaviers / gist:7360908
Last active April 25, 2024 16:14
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kevinconway
kevinconway / Universal JavaScript Modules.rst
Last active March 10, 2019 03:45 — forked from millermedeiros/universal-module.js
Universal JavaScript Module that supports AMD (RequireJS), Node.js, and the browser.