Skip to content

Instantly share code, notes, and snippets.

@evdenis
evdenis / vpnsetup.sh
Last active August 29, 2015 14:23 — forked from hwdsl2/.MOVED.md
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
@evdenis
evdenis / mod_cloudflare_update.sh
Created July 18, 2016 11:34
Apache mod cloudflare installation
#!/bin/sh -x
set -e
cd /tmp
wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
apxs2 -a -i -c mod_cloudflare.c
service apache2 restart
@evdenis
evdenis / disable_enable_ap_cores.sh
Created July 18, 2016 11:37
Disable/Enable AP cores of cpu (Linux)
#!/bin/bash
regexp='[0-9]*'
# Disable all APs
for i in /sys/devices/system/cpu/cpu*
do
cpu=${i##*/}
cpu_num="${cpu#cpu}"
if expr match "$cpu_num" "\($regexp\)" > /dev/null
@evdenis
evdenis / linux_kernel_keyboard_layout.patch
Created July 18, 2016 11:43
Linux kernel patch for change of keyboard layout
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 78d2499..de03463 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -431,6 +431,35 @@ void input_event(struct input_dev *dev,
{
unsigned long flags;
+ if (type == EV_KEY) {
+ switch (code) {
@evdenis
evdenis / .xmodmaprc
Created July 18, 2016 11:45
An example of xmodmap configuration
remove Lock = Caps_Lock
remove Shift = Shift_L
keysym Caps_Lock = Shift_L
keysym Shift_L = Caps_Lock
add Lock = Caps_Lock
add Shift = Shift_L
remove Control = Control_L
@evdenis
evdenis / swap.kmap
Created July 18, 2016 11:47
An example of kmap configuration
keymaps 0-2,4-6,8-9,12
keycode 42 = Caps_Lock
keycode 58 = Shift
keycode 29 =
keycode 125 = Alt
keycode 56 = Control
keycode 100 = Control
@evdenis
evdenis / gcc_extensions_example.c
Created July 18, 2016 11:56
Test of gcc extensions __builtin_return_address && __label__
#include <stdio.h>
void *
test2(void)
{
return __builtin_return_address(1);
}
void *
test1(void *( *func )( void ))
@evdenis
evdenis / ghost_upgrade.sh
Created July 18, 2016 12:02
Upgrade script for Ghost blogging platform
#!/bin/bash -x
# Остановить скрипт, если любая команда завершится с ошибкой
set -e
# -- BEGIN CONFIGURATION --
## Директория, где располагаются файлы Ghost
ghost_dir='/var/www/ghost'
## Директория, куда загрузить обновлённую версию
download_dir="$(mktemp -d)"
@evdenis
evdenis / ghost.conf
Created July 18, 2016 12:07
Apache configuration for Ghost blogging platform through unix socket
<VirtualHost *:80>
ServerName blog.llkl.org
ServerAdmin admin@llkl.org
ProxyRequests Off
ProxyPreserveHost On
<Location />
ProxyPass unix:/run/ghost/sock|http://127.0.0.1/
ProxyPassReverse unix:/run/ghost/sock|http://127.0.0.1/
@evdenis
evdenis / META
Created December 18, 2016 12:57 — forked from kerneis/META
CIL plugin example
version = "0.1"
description = "count and display the number of function calls"
archive(byte,plugin) = "countCalls.cma"
archive(native,plugin) = "countCalls.cmxs"