Skip to content

Instantly share code, notes, and snippets.

View JamesTheHacker's full-sized avatar

0xDEADBEEF JamesTheHacker

  • United Kingdom
View GitHub Profile
@gaearon
gaearon / connect.js
Last active December 11, 2024 07:55
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@xameeramir
xameeramir / default nginx configuration file
Last active December 9, 2024 01:45
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@gaearon
gaearon / slim-redux.js
Last active December 3, 2024 06:34
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@LouWii
LouWii / iptables-config-script
Last active June 20, 2024 10:08
Bash script to configure iptables for a web server. Some rules can be removed depending on used services.
#!/bin/sh
# Empty all rules
sudo iptables -t filter -F
sudo iptables -t filter -X
# Bloc everything by default
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
@sachin-handiekar
sachin-handiekar / gist:3317727
Created August 10, 2012 20:48
UK Access Point Name (APN) Settings for Mobile Broadband - UK
Note : Dial - *99#
Vodafone
Vodafone has several possible options for Pay As You Go SIM cards. Try each one in turn until the connection works. All use the same username and password.
APN (contract): internet
APN (PAYG): pp.internet
APN (PAYG): ppbundle.internet
APN (PAYG): smart
APN (PAYG): pp.vodafone.co.uk