Skip to content

Instantly share code, notes, and snippets.

View ivanleoncz's full-sized avatar
🔬
Bjarne Stroustrup is someone to admire.

ivanleoncz ivanleoncz

🔬
Bjarne Stroustrup is someone to admire.
View GitHub Profile
@pksunkara
pksunkara / config
Last active July 16, 2024 06:57
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@arpit
arpit / Android TimeZone Ids
Created June 20, 2011 13:26
List of all Android TimeZone ids
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@fprochazka
fprochazka / named.conf
Created February 17, 2012 15:15
Bind9 config files
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
@LeZuse
LeZuse / detect.py
Created May 2, 2012 18:28
Flask browser detection
browser = request.user_agent.browser
version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
platform = request.user_agent.platform
uas = request.user_agent.string
if browser and version:
if (browser == 'msie' and version < 9) \
or (browser == 'firefox' and version < 4) \
or (platform == 'android' and browser == 'safari' and version < 534) \
or (platform == 'iphone' and browser == 'safari' and version < 7000) \
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@jtomaszewski
jtomaszewski / iptables.sh
Created November 24, 2013 17:55
A basic, example iptables file you can use to configure your VPS.
#!/bin/sh
iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A FORWARD -o lo -j ACCEPT
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
@hanxue
hanxue / syntax-highlight.html
Created March 26, 2014 10:06
Syntax Highlighting on Blogger
1. Add this before </body>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
2. Encapsulate your code block with <pre> tag and the "prettyprint" class
<pre class="prettyprint">
$(function() {
alert('I am using Prettify as Syntax Highlighter');
});
</pre>
@guyellis
guyellis / renameMongoField.js
Last active November 30, 2021 23:36
How to rename a field in all documents in a collection in MongoDB
// Params
// 1. {} add a query in here if you don't want to select all records (unlikely)
// 2. $rename one or more fields by setting the keys of the object to the old field name and their values to the new field name.
// 3. Set multi to true to force it to operate on all documents otherwise it will only operate on the first document that matches the query.
//
// Run this in the MongoDB shell.
db.<collectionName>.update( {}, { $rename: { '<oldName1>': '<newName1>', '<oldName2>': '<newName2>' } }, {multi: true} )
@nishantmodak
nishantmodak / nginx.conf.default
Last active May 26, 2024 19:29
Default Nginx Conf
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.
@wbroek
wbroek / importcert.sh
Created June 2, 2015 09:15
Convert cert key to bks for Android SSL Pinning
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Usage: importcert.sh <CA cert PEM file> <bouncy castle jar> <keystore pass>"
exit 1
fi
CACERT=$1
BCJAR=$2
SECRET=$3