Skip to content

Instantly share code, notes, and snippets.

View remoharsono's full-sized avatar

Remo Harsono remoharsono

View GitHub Profile
@pksunkara
pksunkara / config
Last active April 28, 2024 18:59
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
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@huyz
huyz / main_decompiled.js
Created September 6, 2011 12:32
Google+ Translate extension main.js decompiled
/* Copyright 2011 Google */
(function() {
var injectionScript = fillInTemplate("(function(){({{$code}})();})();", {
code: window.injection.toString()
}),
injectorScript = fillInTemplate("(function(){({{$code}})();})();", {
code: window.injector.toString()
});
delete window.injector;
delete window.injection;
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@emptyhammond
emptyhammond / gist:1603144
Created January 12, 2012 21:11
Make a PUT request with jQuery.ajax()
$.ajax({
type: 'POST', // Use POST with X-HTTP-Method-Override or a straight PUT if appropriate.
dataType: 'json', // Set datatype - affects Accept header
url: "http://example.com/people/1", // A valid URL
headers: {"X-HTTP-Method-Override": "PUT"}, // X-HTTP-Method-Override set to PUT.
data: '{"name": "Dave"}' // Some data e.g. Valid JSON as a string
});
/* Some clients do not support PUT or it’s difficult to send in a PUT request. For these cases, you could POST the request with a request header of X-HTTP-Method-Override set to PUT. What this tells the server is that the intended request is a PUT. Obviously this relies on the API you are accessing making use of the X-HTTP-Method-Override Header.*/
@rca
rca / ajax_setup.js
Created January 29, 2012 00:27
Setup Django CSRF token in JQuery AJAX requests
/**
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off.
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request
*/
function getCookie(name)
{
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
@mhulse
mhulse / allow_tags.py
Created February 4, 2012 00:52
[Django 1.3] Template tag that allows Django tags in variables (i.e. flatpage content).
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
# http://www.soyoucode.com/2011/set-variable-django-template
# http://djangosnippets.org/snippets/861/
# http://stackoverflow.com/questions/4183252/what-django-resolve-variable-do-template-variable
# https://docs.djangoproject.com/en/dev/ref/templates/api/
@niczak
niczak / gist:2003485
Created March 8, 2012 21:14
PHP/SOAP and Microsoft Exchange
<?php
/*
test.php
Proof of concept testing to see if we can get
PHP/SOAP talking to EWS. Thanks to Thomas Rabaix
for his documentation on NTLM auth in SOAP and to
Erik Cederstrand for his article on SOAP/Exchange.
@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@skarllot
skarllot / backup_mysqldb.sh
Last active November 30, 2022 08:50
Bash script to backup all mysql databases thru mysqldump
#!/bin/bash
# Destiny folder where backups are stored
DEST=/tmp/bacula/server01
CURRDATE=$(date +"%F")
# Hostname where MySQL is running
HOSTNAME="srv-mysql"
# User name to make backup
USER="root"