Skip to content

Instantly share code, notes, and snippets.

View tujlaky's full-sized avatar

Ujlaky Tibor tujlaky

  • Budapest
View GitHub Profile
@tujlaky
tujlaky / fix-dns.sh
Last active November 14, 2024 14:29
Fix DNS after VPN (OpenVPN or Tunnelblick) disconnect issues
#!/bin/sh
# https://github.com/Tunnelblick/Tunnelblick/issues/789
echo-active-dns() {
echo Current DNS server: `scutil --dns | grep 'nameserver' | uniq | awk '{print \$3}'`
}
alias restart-dns="networksetup -setdnsservers Wi-Fi empty; echo-active-dns;"
@tujlaky
tujlaky / ExampleController.php
Last active November 4, 2019 09:57
Laravel routing conventions
<?php
class ExampleController extends Controller
{
// GET /entities
public function index() {}
// GET /entities/:id
public function show($id) {}
// POST /entities
@tujlaky
tujlaky / products.sql
Created June 10, 2019 20:54
Get all prestashop products with combinations
SELECT
m.name AS 'Manufacturer',
p.id_product 'Product ID',
pl.name 'Product Name',
GROUP_CONCAT(DISTINCT(al.name) SEPARATOR ", ") AS 'Combination',
GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") AS 'Categories',
p.price 'Price',
pa.price 'Combination Price',
p.id_tax_rules_group 'VAT Group',
p.wholesale_price 'Wholesale Price',
@tujlaky
tujlaky / fix.sh
Created March 26, 2019 08:11
Remove the delay from the google web designer demos
#!/bin/bash
# See: https://groups.google.com/forum/#!topic/gwdbeta/WzgS3Z6H-Xc
find -iname index.html -exec sed -i -e 's/<\/body>/<script data-exports-type="dclk-quick-preview">studio.Enabler.setRushSimulatedLocalEvents(true);<\/script><\/body>/g' {} \;
@tujlaky
tujlaky / ssl-hack.sh
Created April 4, 2018 12:47
linux ssl hack
echo QUIT | openssl s_client -connect localhost:8101 | sed -ne '/BEGIN CERT/,/END CERT/p' > my-cert
certutil certutil -d sql:~/.pki/nssdb -A -t "P,," -n my-cert -i my-cert
@tujlaky
tujlaky / drop-tables.sh
Created February 13, 2018 21:24
Script for delete all dynamodb tables
for i in `aws dynamodb list-tables | jq .'TableNames[]' -r`; do aws dynamodb delete-table --table-name $i; done;
@tujlaky
tujlaky / mongodump.sh
Created November 14, 2017 17:39
docker mongodump
docker exec container mongodump --archive > your_dump
@tujlaky
tujlaky / arch_rss.rb
Created January 21, 2016 13:30
Get arch linux RSS
#!/usr/local/rvm/wrappers/ruby-2.1.1/ruby
# encoding: UTF-8
require 'rss'
require 'open-uri'
require 'i18n'
I18n.backend.store_translations :hu, {
:date => {
:formats => {
:default => "%Y.%m.%d"
@tujlaky
tujlaky / ttf2otf.sh
Created January 21, 2016 13:28
Convert ttf fonts to otf
#!/bin/sh
# Convert an OTF font into TTF an EOT formats.
otfFont="$1.otf"
ttfFont="$1.ttf"
fontforge -c '
import fontforge
font = fontforge.open("'$ttfFont'")
font.generate("'$otfFont'")
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
import fontforge
import os
import re