Skip to content

Instantly share code, notes, and snippets.

View jsgao0's full-sized avatar

Anson jsgao0

View GitHub Profile
@Karolass
Karolass / backup.sh
Created July 31, 2018 11:08
mysql backup
#!/bin/sh
DBUSER=ooo
DBPASS=xxx
DBNAME=db
DAYS=7
DEST=/path/your/folder
DATE=`date +%Y%m%d`
@aibrean
aibrean / map-scroll.js
Created February 11, 2015 20:55
Enable Google map zooming on click only (disable scrolling)
// Disable scroll zooming and bind back the click event
var onMapMouseleaveHandler = function (event) {
var that = $(this);
that.on('click', onMapClickHandler);
that.off('mouseleave', onMapMouseleaveHandler);
that.find('iframe').css("pointer-events", "none");
// pointer-events needs to be added as a style on the iframe
}
@cgswong
cgswong / logstash.conf
Last active June 24, 2021 18:08
Logstash configuration file.
# #####################################################################
# DESC: Logstash configuration file. Typically forwarding logs to
# Elasticsearch instance.
# #####################################################################
# Where to get input
input {
# Get input from standard input device/interface
stdin {
type => "stdin-type"
@ekristen
ekristen / check_docker_container.sh
Last active July 15, 2024 09:29
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@jonathantneal
jonathantneal / README.md
Last active November 9, 2023 21:10
createElement.js // a 300 byte DOM Element creator

createElement.js

createElement.js lets document.createElement use CSS selectors.

This is a pretty useful library for building out DOM elements. The whole thing runs on one regex and a for loop, so it’s plenty fast. The script is 300 bytes when compressed and gzipped. For 524 bytes (advanced), it includes nesting support and can generate entire DOM hierarchies, including text nodes.

Usage

document.createElement(); // generates <div />
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active July 2, 2024 00:02
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@lucasjones
lucasjones / app.js
Last active January 29, 2017 05:49
Simple node.js static and dynamic file express server
/***********************************
*Simple node.js static and dynamic file express server
*Author: Lucas Jones
***********************************/
//Load node.js modules
var express = require('express'); //Require the Express Module
//Runs every time a request is recieved
function logger(req, res, next) {
@andreia
andreia / gist:3354204
Created August 15, 2012 00:29
ORACLE: Show size in Kb of BLOB fields
SELECT round(DBMS_LOB.getlength(A.FILE)/1024) KB FROM MY_TABLE A
@bricef
bricef / AES.c
Last active May 11, 2024 21:15
A simple example of using AES encryption in Java and C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>