Skip to content

Instantly share code, notes, and snippets.

@sl0ki
sl0ki / LocalStorage Wrapper
Last active August 29, 2015 14:18
JS LocalStorage Wrapper
/*
* Local Storage wrapper
*/
var LStore = {
set: function(key, value) {
var rec = {
value: value,
updated: new Date().getTime()
};
#include <errno.h> // for errno
#include <fcntl.h> // for O_RDONLY
#include <stdio.h> // for fprintf()
#include <stdlib.h> // for EXIT_SUCCESS
#include <string.h> // for strerror()
#include <sys/event.h> // for kqueue() etc.
#include <unistd.h> // for close()
#include <CoreServices/CoreServices.h>
void mycallback(
import fsevents
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 1024
MESSAGE = "Hello, World!"
host = 'localhost';
import fsevents
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 1024
MESSAGE = "Hello, World!"
host = 'localhost';
/* Sample UDP server */
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
int main(int argc, char**argv)
{
int sockfd,n;
struct sockaddr_in servaddr,cliaddr;
web:
image: nginx
container_name: nginx_main
volumes:
- /shared/nginx/config/:/etc/nginx/conf.d/
- /shared/nginx/static/:/usr/share/nginx/html/
- /shared/nginx/ssl/:/etc/nginx/ssl/
ports:
- "80:80"
- "443:443"
# main DNS server for containers
dns:
image: phensley/docker-dns
container_name: dns
restart: always
volumes:
- /var/run/docker.sock:/docker.sock
ports:
- "172.17.42.1:53:53/udp" # set dns port to docker bridge IP
# nginx main (bulild system 80,443 ports)
@sl0ki
sl0ki / vk_restore_message
Created March 18, 2016 14:17
how to restore deleted vk messages
// got to vk.im/ page
// copy paste this js to console and run
// profit
var lastMsgId = parseInt(geByClass('dialogs_row ')[0].className.match(/dialogs_msg(.*)/)[1]);
var lastMsgId = lastMsgId + 10;
for (var i = lastMsgId; i > lastMsgId - 100; i--) {
var id = i;
console.log('try restore message: ' + id);
ajax.post('al_mail.php', {act: 'a_restore', id: i, from: 'im', hash: cur.mark_hash, gid: cur.gid});
@sl0ki
sl0ki / 0_reuse_code.js
Created December 21, 2016 10:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console