Skip to content

Instantly share code, notes, and snippets.

View RealJTG's full-sized avatar
🇺🇦
#StopRussianAggression

RealJTG

🇺🇦
#StopRussianAggression
View GitHub Profile
@spudbean
spudbean / gist:1558257
Last active June 27, 2024 09:36
Look of disapproval and other emoticons
ಠ_ಠ
( ͡° ͜ʖ ͡°)
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
http://www.fileformat.info/convert/text/upside-down.htm
WRTTN http://wrttn.me/30dbfd/
Unicode Emoticons
@DavidMah
DavidMah / filedownloader.js
Created August 30, 2012 17:03
File Download requests using jquery/POST request with psuedo ajax
// Takes a URL, param name, and data string
// Sends to the server.. The server can respond with binary data to download
jQuery.download = function(url, key, data){
// Build a form
var form = $('<form></form>').attr('action', url).attr('method', 'post');
// Add the one key/value
form.append($("<input></input>").attr('type', 'hidden').attr('name', key).attr('value', data));
//send request
form.appendTo('body').submit().remove();
@seberg
seberg / rolling_window.py
Created October 10, 2012 14:38
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
@st4lk
st4lk / vkcom_audio_download.py
Last active October 24, 2023 13:13
Python: vkontakte.ru (vk.com) audio music downloader
# -*- coding: utf-8 -*-
"""
Скрипт для скачивания музыки с сайта vkontakte.ru (vk.com)
Запуск:
python vkcom_audio_download.py
Принцип работы:
Скрипт проверяет сохраненный access_token. Если его нет или срок истек,
то открывается страница в браузере с запросом на доступ к аккаунту.
@webmasterkai
webmasterkai / img.l
Last active November 3, 2018 08:49 — forked from phpdude/nginx.conf
Mirror remote image files, supports dynamic resizing of images. nginx image_filter remote fetching with a local mirror of original and resized image. Using try_files instead of if statements and proxy_pass with proxy_store for permanent local storage. No cache expiration, that will need to be handled outside of this.
server {
server_name img.l;
root /var/www/cache/store/ns365;
index index.html;
# This requests the original file from itself and then resizes the image.
location ~ /resize/(\d+)x(\d+)/(.*) {
proxy_pass http://img.l/$3;
image_filter resize $1 $2;
image_filter_jpeg_quality 90;
@SaneMethod
SaneMethod / ajaxCachePrefilter.js
Last active May 3, 2019 13:01
Ajax prefilter for caching, based on paul irish's work at https://github.com/paulirish/jquery-ajax-localstorage-cache, made to work with jqXHR Deferred Promises when paired with an appropriate ajaxTransport.
/**
* Prefilter for caching ajax calls - adapted from
* https://github.com/paulirish/jquery-ajax-localstorage-cache, made to work with jqXHR Deferred Promises.
* See also $.ajaxTransport.
* New parameters available on the ajax call:
* localCache : true, // required if we want to use the cache functionality
* cacheTTL : 1, // in hours. Optional
* cacheKey : 'post', // optional
* isCacheValid : function // optional - return true for valid, false for invalid
* @method $.ajaxPrefilter
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <cburgmer@ira.uka.de>'
__url__ = 'http://github.com/cburgmer/upsidedown'
@Tucos
Tucos / buttonpress.c
Created August 4, 2014 19:17
Clickable conky thingies
/* Compile with `make CFLAGS='-std=c99' LOADLIBES='-lX11' buttonpress` */
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
Window GetWindowFromID(Display *display, Window start, int targetid, int level) {
Window root, parent, *children;
unsigned int nchildren;
@maximal
maximal / idea.md
Last active February 28, 2019 13:46
Быстрая установка и обновление PhpStorm и других IDE на основе IDEA

Быстрая установка и обновление PhpStorm и других IDE на основе IDEA

Быстрее всего эти операции проделывать в терминале, заглядывая в браузер за ссылкой на новый файл.

Установка

Переходим в каталог /opt — он специально для всякого говна не из репозиториев:

@briancavalier
briancavalier / serialize-function.js
Created February 10, 2015 18:34
Serializing / deserializing JavaScript functions *with free variables*
var a = 123, b = 'hello';
function test(x, y) {
console.log(this);
return a + x + b + y;
}
// Serialize a function *with its captured environment*
var sf = serialize(test, { a: a, b: b });
// Deserialize with captured environment