Skip to content

Instantly share code, notes, and snippets.

@MikeNGarrett
MikeNGarrett / siege
Last active April 3, 2024 03:49
Siege with JSON POST data
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json'
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
@makmanalp
makmanalp / comparison.md
Last active March 14, 2023 14:58
Angular vs Backbone vs React vs Ember notes

Note: these are pretty rough notes I made for my team on the fly as I was reading through some pages. Some could be mildly inaccurate but hopefully not terribly so. I might resort to convenient fiction & simplification sometimes.

My top contenders, mostly based on popularity / community etc:

  • Angular
  • Backbone
  • React
  • Ember

Mostly about MVC (or derivatives, MVP / MVVM).

@tyrells
tyrells / disable-service.yml
Last active October 19, 2023 20:53
Ansible task to stop service even if it doesn't exist
# This task will stop and disable a service without failing if the service does not exist.
# Requires Ansible 1.4 or newer.
# Update Dec 2016: Have rewritten this for the latest version of ansible and put conditions for both Ubuntu and CentOS
- name: "disable unused services"
service: name={{item}} state=stopped enabled=no
register: command_result
failed_when: "unused_disable|failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)"
with_items:
@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@gary-liguoliang
gary-liguoliang / gist:9403188
Last active September 3, 2015 10:01
Using JNDI in Spring - JNDI DataSource / Environment - using a <jee:jndi-lookup string inside an instance of PropertyPlaceholderConfigurer
<!-- by https://gist.github.com/prule/5523826 -->
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">
@chrismccoy
chrismccoy / gitcheats.txt
Last active April 20, 2024 08:50
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# edit all commit messages
git rebase -i --root
# clone all your repos with gh cli tool
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone
@esfand
esfand / nginxvarcore.md
Last active May 17, 2021 16:39
Nginx Variables

Embedded Variables

The ngx_http_core_module module supports embedded variables with names matching the Apache Server variables. First of all, these are variables representing client request header fields, such as $http_user_agent, $http_cookie, and so on. Also there are other variables:

  • $arg_name
    argument name in the request line
@newgiin
newgiin / Sublime_Monokai.xml
Last active June 29, 2018 20:43
This theme emulates the Monokai theme found in the Sublime Text 2 editor. Must enable global-{font, fontsize, bold} and global background colour.
<?xml version="1.0" encoding="Windows-1252" ?>
<!--
Notepad++ Custom Style
Style name: Sublime Monokai
Author: Andrew Nguyen, Joni Eskelinen
Date: 2009-04-06 (last changed 2013-08-29)
Languages: php, html, css, xml, javascript, python, sql, c, c++,
assembly, bash, batch, lua at least for detail. Everything else more or less...
Info: Using Joni Eskelinin's Obsidian theme as a base, this theme
@jasondavies
jasondavies / LICENSE
Last active October 6, 2018 08:54
Zoom by Rectangle
Copyright 2012 Jason Davies https://www.jasondavies.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@cjgiridhar
cjgiridhar / tornadowebsocket.py
Created August 18, 2012 17:14
Tornado - WebSockets
import tornado.ioloop
import tornado.web
import tornado.websocket
class Socket(tornado.websocket.WebSocketHandler):
def open(self):
print "Socket opened"
def on_message(self, message):
self.write_message("Msg is " + message)