Skip to content

Instantly share code, notes, and snippets.

@ageis
ageis / systemd_service_hardening.md
Last active May 14, 2025 22:12
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@manuelbieh
manuelbieh / sequelize-schema-file-generator.js
Last active April 5, 2025 20:02
Automatically generates migration files from your sequelize models
import * as models from "models";
import Sequelize from "sequelize";
import fs from "fs";
delete models.default;
const sequelize = new Sequelize(
'',
'',
'', {
@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])) {
@notpeelz
notpeelz / veracrypt_mount.sh
Last active September 27, 2016 15:28
VeraCrypt volume (secure) mounting via GUI
#!/bin/bash
DEVICE=/dev/sda1
IMAGE_PATH='/media/$1/Storage/.veracrypt/volume'
MOUNT_PATH='/mnt/volume'
if [[ "$USER" != "root" ]]; then
gvfs-mount -d $DEVICE
gksu -D $(basename $0) $0 $USER
exit $?
@jackiewu
jackiewu / Rotating 3D Slider.markdown
Created August 1, 2015 04:01
Rotating 3D Slider

Rotating 3D Slider

Sourse of inspiration - http://rdcm.com/en/

Slider not working in IE, because of transform-style: preserve-3d. Handle control is broken in FF during rotation, because FF still have this nasty bug with stacking context and translateZ, and it's simply breaks z-index order for elements.

I tried to create this slider as sort of plugin/component. It's more like a practice, so js architecture is pretty random. But it's working :) And you can use multiple sliders on page with different sizes and different settings (you can find options object in js).

Don't forget to rotate slides with control handle.

@staltz
staltz / index.ios.js
Created April 7, 2015 06:43
Experiment with Cycle.js and React Native
'use strict';
var React = require('react-native');
var Cycle = require('cyclejs');
var {Rx, h} = Cycle;
var createExperimentalIOSRenderer = require('./src/ios-renderer.ios.js');
var {StyleSheet, Text, TextInput, View} = React;
var styles = StyleSheet.create({
container: {
@sebmarkbage
sebmarkbage / Enhance.js
Last active February 10, 2025 06:23
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
source "https://rubygems.org"
gem 'eventmachine'
gem 'rubysl-stringio'
gem 'sinatra'
gem 'yajl-ruby', require: 'yajl'
gem 'thin'
gem 'em-websocket', :git=>'https://github.com/igrigorik/em-websocket.git'
@steve-ng
steve-ng / nginx.conf
Last active May 28, 2024 08:27
Nginx reverse proxy wss with ssl
server {
listen 443 ssl;
server_name xxx.xx.io
ssl on;
ssl_certificate /etc/asterisk/certs/xxx.io.pem;
ssl_certificate_key /etc/asterisk/certs/xxx.io.key;
ssl_session_timeout 5m;
@kafene
kafene / dnscrypt-installation.md
Last active July 30, 2017 20:09
DNSCrypt Installation

Create and enter a working directory

mkdir -p ~/dnscrypt-working-directory && cd ~/dnscrypt-working-directory

Become root

sudo -s