Skip to content

Instantly share code, notes, and snippets.

@drmalex07
drmalex07 / drupal-entityfieldquery-example-1.php
Last active January 6, 2023 17:12
An example of an EntityFieldQuery in drupal 7. #drupal #php #drupal-entities
<pre><?php
////////////////////////////////////////////////////
// See more at https://drupal.org/node/1343708 //
////////////////////////////////////////////////////
//
// Filter entities based on several {entity,property,field}-based criteria
//
@Hades32
Hades32 / elixir-npp.xml
Created October 14, 2014 18:46
Simple syntax highlighting for Elixir for Notepad++
<NotepadPlus>
<UserLang name="Elixir" ext="ex exs" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="yes" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@leandromoreira
leandromoreira / nginx.conf
Last active November 29, 2023 11:39
nginx.conf optmized for http/2 = HTTPS TLS (ssl)
# command to generate dhparams.pen
# openssl dhparam -out /etc/nginx/conf.d/dhparams.pem 2048
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;
limit_req_status 444;
limit_conn_status 503;
proxy_cache_path /var/lib/nginx/proxy levels=1:2 keys_zone=backcache:8m max_size=50m;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
@7h3rAm
7h3rAm / internet.py
Last active April 26, 2021 20:57
Quick Internet Connectivity Test: Invokes a connect on Google's public DNS server: 8.8.8.8:53/TCP with a socket timeout of 1 second.
import socket
def internet(host="8.8.8.8", port=53, timeout=3):
"""
Host: 8.8.8.8 (google-public-dns-a.google.com)
OpenPort: 53/tcp
Service: domain (DNS/TCP)
"""
try:
socket.setdefaulttimeout(timeout)
@LeonardoCardoso
LeonardoCardoso / gitzip.sh
Last active October 9, 2023 22:38
Zip folder ignoring files listed on .gitignore
#...
function gitzip() {
git archive -o $@.zip HEAD
}
#... gitzip ZIPPED_FILE_NAME
@piekie
piekie / RootUtils.java
Last active July 30, 2021 08:09
Utils : Kill and Force-Stop functions for android app.
public class RootUtils {
private static Process su;
public static void gainRoot() {
try {
su = Runtime.getRuntime().exec("su");
} catch (IOException e) {
e.printStackTrace();
}
@0xjac
0xjac / private_fork.md
Last active May 22, 2024 11:28
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@TahaSh
TahaSh / index.html
Created December 9, 2016 12:45
Reusable Autocomplete-Input Component in Vue 2.1
<title>Vue Awesome Autocomplete</title>
<link rel="stylesheet" href="https://unpkg.com/bulma/css/bulma.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
<autocomplete-input
:options="options"
@select="onOptionSelect"
@dankrause
dankrause / postgresql_recursive.sql
Last active February 26, 2024 16:03
An example of creating a recursive postgresql query to generate data about parent-child relationships within a single table.
CREATE TABLE test
(
id INTEGER,
parent INTEGER
);
INSERT INTO test (id, parent) VALUES
(1, NULL),
(2, 1),
@LostKobrakai
LostKobrakai / post.md
Last active April 7, 2020 20:07 — forked from nahtnam/post.md
Using Laravel-Mix with Phoenix

Introduction

Laravel-Mix is "an elegant wrapper around Webpack for the 80% use case". It has nothing to do with Elixir's Mix and does not require Laravel to work!

Set up

Create a new phoenix application with mix phx.new. You may choose to add the --no-brunch flag to stop brunch from being intiailized, but I personally prefer leaving that in and replacing brunch so that the folder structure is set up for me.

$ mix phx.new demo

Install Laravel-Mix