Skip to content

Instantly share code, notes, and snippets.

View Spoygg's full-sized avatar

Ivan Ivanić Spoygg

View GitHub Profile
@Spoygg
Spoygg / sync_with_history.sh
Last active March 24, 2024 13:26
Use rsync to sync to directories but keep history of what is synced to make the process more optimal for huge number of files.
#!/bin/bash
#
# Sync two directories with rsync, but keep history to optimize the process.
# On subsequent runs it will only sync files added since last sync.
# This allows an easy continue in case script is interupted.
# This also helps with network connectivity to remotes since each file is
# transfered by initiating new rsync command. This solves one issue I have
# faced when syncing large number of files and that is connection breaking
# if the process takes to long (in my case it was about 10hrs to transfer all
# the files).
@Spoygg
Spoygg / gist:3122226
Created July 16, 2012 11:29
Keyboard switches for XKB setxkbmap
altwin:menu = +altwin(menu)
altwin:meta_alt = +altwin(meta_alt)
altwin:ctrl_win = +altwin(ctrl_win)
altwin:meta_win = +altwin(meta_win)
altwin:left_meta_win = +altwin(left_meta_win)
altwin:super_win = +altwin(super_win)
altwin:hyper_win = +altwin(hyper_win)
altwin:alt_super_win = +altwin(alt_super_win)
altwin:swap_lalt_lwin = +altwin(swap_lalt_lwin)
grp:switch = +group(switch)
context:
edit
attributes[pickedContent][id]:
1866
attributes[pickedContent][title]:
Managing Availability in Service Based Deployments with Continuous Testing
attributes[pickedContent][url]:
https://sf-engineering.test/managing-availability-in-service-based-deployments-with-continuous-testing-61be968da4a/
attributes[pickedContent][type]:
@Spoygg
Spoygg / symfony1.4-show-all-form-errors.php
Created August 3, 2012 09:05
Symfony 1.4 get all form errors.
<ul class="error_list">
<?php foreach( $form->getGlobalErrors() as $name => $error ) : ?>
<li><?php echo $name ?> : <?php echo $error ?></li>
<?php endforeach ?>
<?php $errors = $form->getErrorSchema()->getErrors() ?>
<?php if ( count($errors) > 0 ) : ?>
<?php foreach( $errors as $name => $error ) : ?>
<li><?php echo $name ?> : <?php echo $error ?></li>
<?php endforeach ?>
<?php endif ?>
@Spoygg
Spoygg / Add-WordPress-Dashboard-Widget.php
Created August 6, 2019 09:16 — forked from SalmanRavoof/Add-WordPress-Dashboard-Widget.php
Add a custom widget to your WordPress dashboard.
// Add a new widget to the dashboard using a custom function
function wpmudev_add_dashboard_widgets() {
wp_add_dashboard_widget(
'wpmudev_dashboard_widget', // Widget slug
'My Custom Dashboard Widget', // Widget title
'wpmudev_new_dashboard_widget_function' // Function name to display the widget
);
}
// Register the new dashboard widget with the 'wp_dashboard_setup' action
add_action( 'wp_dashboard_setup', 'wpmudev_add_dashboard_widgets' );
@Spoygg
Spoygg / Mencoder add .ass subs
Created April 26, 2012 06:35
Mencoder add .ass subs to mp4, output to avi
mencoder movie.mp4 -sub subtitle.ssa -vf fixpts=fps=30000/1001,ass,fixpts -ass -o movie.avi -oac mp3lame -ovc lavc -lavcopts vbitrate=1200
describe('Test example.com', function(){
before(function(done) {
client.init().url('http://example.com', done);
});
describe('Check homepage', function(){
it('should see the correct title', function(done) {
client.getTitle(function(err, title){
expect(title).to.have.string('Example Domain');
done();
add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['ABC'] = __( 'Srpski dinar', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
[2013-09-12 14:15:21] request.CRITICAL: Uncaught PHP Exception Elastica\Exception\ResponseException: "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[J_rOiEuqTbmdrGCcZgT8Yw][itsmyplay][4]: SearchParseException[[itsmyplay][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"http:"}},"from":0,"size":3}]]]; nested: QueryParsingException[[itsmyplay] Failed to parse query [http:]]; nested: ParseException[Cannot parse 'http:': Encountered "<EOF>" at line 1, column 5.
Was expecting one of:
<BAREOPER> ...
"(" ...
"*" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ...
[
{
'id': 1,
'name': 'timezone name'
},
{
'id': 2,
'name': 'timezone name'
},
{